package com.pap.rocketmq.repository;

import com.pap.rocketmq.entity.MqCount;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.Optional;

public interface MqCountRepository extends JpaSpecificationExecutor<MqCount>,PagingAndSortingRepository<MqCount, String> {


    @Modifying(clearAutomatically = true)
    @Query("update MqCount c set c.count =c.count + 1 where c.id ='1'")
    void updateCount();

    Optional<MqCount> findById(String id);

}

